<!-- 审批 -->
<template>
	<view>
		<u-tabs :list="list" :is-scroll="false" :show-bar="false" :current="current" @change="change"></u-tabs>
		<!-- <u-input v-model="value" type="text" :border="border" /> -->
		<view class="content container-app">
			<view v-show="current==0">
				<view class="item" v-for="(item,index) in dataList">
					<view class="title">
						<text>正常通行 郝晓丽（大领导）</text>
						<text>正常通行</text>
					</view>
					<view class="content">
						<image src="../../static/logo.png" mode=""></image>
						<view>
							<text>12/06/2020 04:39:40</text>
							<view>
								行程<text>12/06/2020 04:39:40</text>
							</view>
						</view>
						<button type="primary" @click="getdetail()">查 </br>看</button>
					</view>
				</view>
				<!-- <uni-card> -->
				<!-- </uni-card> -->
			</view>
			<view v-show="current==1">
				<view class="item" v-for="(item,index) in dataList1">
					<view class="title">
						<text>正常通行 郝晓丽（大领导）</text>
						<text>正常通行</text>
					</view>
					<view class="content">
						<image src="../../static/logo.png" mode=""></image>
						<view>
							<text>12/06/2020 04:39:40</text>
							<view>
								行程<text>12/06/2020 04:39:40</text>
							</view>
						</view>
						<button type="primary" @click="getdetail()">查 </br>看</button>
					</view>
				</view>
				<!-- <uni-card> -->
				<!-- </uni-card> -->
			</view>
		</view>
		<!-- </view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: '',
				border: true,
				current: 0,
				items: ['当前审批', '历史审批'],
				searchValue: '',
				list: [{
					name: '当前审批'
				}, {
					name: '历史审批'
				}],
				dataList1: []
			}
		},
		props:['dataList'],
		watch: {
			current(e) {
				
				if(e==1){
					console.log(e);
					this.getHistoryList()
				}
			}
		},
		created() {
			this.getList()
		},
		methods: {
			onClickItem(res) {
				this.current = res.currentIndex
				console.log(res.currentIndex)
			},
			change(index) {
				this.current = index;
			},
			getdetail() {
				uni.navigateTo({
					url: '../index/index'
				})
			},
			getList() {
				this.$api.currentList({}).then(res => {
					this.dataList = res.data
				}).cache(res => {})
			},
			getHistoryList(){
				this.$api.historyList({}).then(res => {
					this.dataList1 = res.data
				}).cache(res => {})
			}
			
		}
	}
</script>

<style lang="scss">
	.segmented-control {
		background: #fff;
	}

	.uni-easyinput {
		background-color: #fff;
		margin: 24rpx;
		width: calc(100% - 48rpx) !important;
	}

	.item {
		background-color: #FFFFFF;
		border-radius: 20rpx;
		overflow: hidden;
		padding: 10rpx;
		padding-bottom: 0;
		padding-right: 0;

		// width: calc(100% - 20rpx);
		.title {
			margin: 12rpx;
			display: flex;
			justify-content: space-between;
			line-height: 30rpx;
			color: #3B3B3B;
			font-size: 32rpx;
			font-weight: 600;

			&>text:last-child {
				color: #7F7F7F;
				font-size: 28rpx;
				font-weight: 100;
			}
		}

		.content {
			display: flex;
			margin: 12rpx;
			margin-top: 40rpx;
			margin-right: 0rpx;
			padding-bottom: 30rpx;

			&>image {
				width: 110rpx;
				height: 110rpx;
				border-radius: 50%;
				margin-right: 12rpx;
			}

			&>view {
				flex: 1;
				height: 110rpx;
				display: flex;
				flex-flow: wrap;
				justify-content: space-around;
				font-size: 26rpx;
				color: #3b3b3b;
				font-weight: 600;
				display: flex;
				flex-flow: column;

				text {
					color: #7F7F7F;
					font-size: 26rpx;
					font-weight: 500;
				}

				text:last-child {
					margin-left: 12rpx;
				}
			}

		}
	}

	.content {
		padding-bottom: 0;
		margin-bottom: 0 !important;
		position: relative;

		&>button {
			position: absolute;
			right: 0;
			bottom: 0;
			width: 80rpx;
			height: 110rpx;
			font-size: 28rpx;
			line-height: 28rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			border-top-right-radius: 0;
			border-bottom-left-radius: 0;
			background-color: #4D7CFB !important;
		}
	}
</style>
